home *** CD-ROM | disk | FTP | other *** search
-
-
-
- VVVVPPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS)))) VVVVPPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))
-
-
-
- NNNNAAAAMMMMEEEE
- vprintf, vfprintf, vsnprintf, vsprintf - print formatted output of a
- variable argument list
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddaaaarrrrgggg....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
-
- iiiinnnntttt vvvvpppprrrriiiinnnnttttffff ((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****ffffoooorrrrmmmmaaaatttt,,,, vvvvaaaa____lllliiiisssstttt aaaarrrrgggg))));;;;
-
- iiiinnnntttt vvvvffffpppprrrriiiinnnnttttffff ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****ffffoooorrrrmmmmaaaatttt,,,, vvvvaaaa____lllliiiisssstttt aaaarrrrgggg))));;;;
-
- iiiinnnntttt vvvvssssnnnnpppprrrriiiinnnnttttffff ((((cccchhhhaaaarrrr ****ssss,,,, ssssiiiizzzzeeee____tttt lllleeeennnn,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****ffffoooorrrrmmmmaaaatttt,,,, vvvvaaaa____lllliiiisssstttt aaaarrrrgggg))));;;;
-
- iiiinnnntttt vvvvsssspppprrrriiiinnnnttttffff ((((cccchhhhaaaarrrr ****ssss,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****ffffoooorrrrmmmmaaaatttt,,,, vvvvaaaa____lllliiiisssstttt aaaarrrrgggg))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _v_p_r_i_n_t_f, _v_f_p_r_i_n_t_f, _v_s_n_p_r_i_n_t_f, and _v_s_p_r_i_n_t_f are the same as _p_r_i_n_t_f,
- _f_p_r_i_n_t_f, _s_n_p_r_i_n_t_f, and _s_p_r_i_n_t_f respectively, except that instead of being
- called with a variable number of arguments, they are called with an
- argument list, _a_r_g, as defined by _s_t_d_a_r_g(5). The _a_r_g parameter must be
- initialized by the _v_a__s_t_a_r_t macro (and possibly subsequent _v_a__a_r_g calls).
- The _v_p_r_i_n_t_f, _v_f_p_r_i_n_t_f, _v_s_n_p_r_i_n_t_f, and _v_s_p_r_i_n_t_f functions do not invoke
- the _v_a__e_n_d macro.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEE
- The following demonstrates the use of _v_f_p_r_i_n_t_f to write an error routine.
-
- The _s_t_d_a_r_g._h header file defines the type _v_a__l_i_s_t and a set of macros for
- advancing through a list of arguments whose number and types may vary.
- The argument _a_p to the vprint family of routines is of type _v_a__l_i_s_t.
- This argument is used with the _s_t_d_a_r_g._h header file macros _v_a__s_t_a_r_t,
- _v_a__a_r_g and _v_a__e_n_d [see _v_a__s_t_a_r_t, _v_a__a_r_g, and _v_a__e_n_d in _s_t_d_a_r_g(5)].
-
- #include <stdio.h>
- #include <stdarg.h>
-
- /*
- * error should be called as:
- * error(function_name, format, arg1, arg2 ...);
- */
- void
- error(char *function_name, char *format, ...)
- {
- va_list args;
-
- va_start(args, format);
- /* print out name of function causing error */
- fprintf(stderr, "ERROR in %s: ", function_name);
- /* print out remainder of message */
- vfprintf(stderr, format, args);
- va_end(args);
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- VVVVPPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS)))) VVVVPPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))
-
-
-
- }
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- printf(3S), stdarg(5).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- _v_p_r_i_n_t_f, _v_f_p_r_i_n_t_f, _v_s_n_p_r_i_n_t_f, and _v_s_p_r_i_n_t_f return the number of
- characters transmitted, or return -_1 if an error was encountered.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-